package com.ymatou.iapi.userservice.testcase;

import java.util.List;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.ymatou.iapi.userregister.parameter.UserRegisterInfoRequestDtoBean;
import com.ymatou.iapi.userregister.service.UserRegisterInfoRequestDtoCall;
import com.ymatou.iapi.userservice.parameter.GetLoginSafeStatusRequestDtoBean;
import com.ymatou.iapi.userservice.parameter.req.CreateUserReq;
import com.ymatou.iapi.userservice.parameter.resp.AuthSafeVerifylogVo;
import com.ymatou.iapi.userservice.parameter.resp.QueryLoginSafeLogResp;
import com.ymatou.iapi.userservice.service.GetLoginSafeStatusRequestDtoCall;
import com.ymt.core.tool.FormatUtil;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.*;
import com.ymt.utils.tag.*;
import com.ymttest.business.service.JUserCallService;
import com.ymttest.database.model.Userinfo;
import com.ymttest.database.sqlwapper.JUserWapper;
import com.ymttest.utils.TestDataManager;
/**
*绑定邮箱Test
*FreeMaker Template自动生成代码
*/
//add(101);//买手本地局域网IP130, //登录历史密码错误-3分钟内大于等于5,需要验证身份
//add(130);//登录历史密码错误-3分钟内大于等于5,需要验证身份
//add(140);//IP黑名单,需要验证身份
//add(155);//IP区域不存在
//add(157);//IP区域状态验证失败
//add(161);//用户最后一次IP区域认证时间验证失败
//add(172);//设备号，CLientID为空
//add(174);//设备号不存在
//add(175);//设备号状态验证失败
//add(176);//ClientId状态验证失败
@TestSuite
public class Ts_GetLoginSafeStatusRequestDto{
	private static GetLoginSafeStatusRequestDtoBean GetLoginSafeStatusRequestDtoBean;
	private static GetLoginSafeStatusRequestDtoCall GetLoginSafeStatusRequestDtoCall;
	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("查询风控信息");
	}

	@Before
	public void caseUp() {
		GetLoginSafeStatusRequestDtoBean=new GetLoginSafeStatusRequestDtoBean();
		GetLoginSafeStatusRequestDtoCall=new GetLoginSafeStatusRequestDtoCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(GetLoginSafeStatusRequestDtoCall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetLoginSafeStatusRequestDto_001() {
		Logger.start(true,"查询用户风控信息,成功");
		try {
			UserRegisterInfoRequestDtoBean regbean = JUserCallService.initUserRegisterInfoRequestDtoBean();
			UserRegisterInfoRequestDtoCall urrc = JUserCallService.UserRegisterInfoRequestDtoCall(regbean);
			JUserCallService.login(regbean.getLoginId(), regbean.getPas(), "app", regbean.getClientIp(), regbean.getDeviceId());
			GetLoginSafeStatusRequestDtoBean.setLoginName(regbean.getLoginId());
			GetLoginSafeStatusRequestDtoCall.setData(GetLoginSafeStatusRequestDtoBean);
			GetLoginSafeStatusRequestDtoCall.callService();			
			Logger.verifyEquals("true", GetLoginSafeStatusRequestDtoCall.getString("Success"), "验证Success");
			Logger.verifyEquals("200", GetLoginSafeStatusRequestDtoCall.getString("ResponseCode"), "验证ResponseCode");
			QueryLoginSafeLogResp resp = GetLoginSafeStatusRequestDtoCall.getQueryLoginSafeLogResp();
			Logger.verifyEquals(urrc.getUserid(),resp.getUserId(),"验证userid");
			Logger.verifyEquals(regbean.getLoginId(),resp.getLoginId(),"验证loginid");
			Logger.verifyEquals(regbean.getLoginMail(),resp.getMail(),"验证mail");
			Logger.verifyEquals(regbean.getLoginMobile(),resp.getMobile(),"验证LoginMobile");
			List<AuthSafeVerifylogVo> list = resp.getSafeVerifyLogList();
			for (AuthSafeVerifylogVo authSafeVerifylogVo : list) {
				Logger.debug(FormatUtil.beanToGSONString(authSafeVerifylogVo));
			}
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
}